<?php

namespace App\Models;

use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class IntegralLog
 * @package App\Models
 * @version September 19, 2017, 7:14 am UTC
 *
 * @property integer user_id
 * @property integer type
 * @property integer add_type
 * @property integer junior_id
 * @property string title
 * @property integer amount
 * @property integer calculate
 */
class IntegralLog extends Model
{
    use SoftDeletes;

    public $table = 'integral_logs';
    

    protected $dates = ['deleted_at'];


    public $fillable = [
        'shop_id',
        'user_id',
        'type',
        'add_type',
        'admin_id',
        'junior_id',
        'title',
        'amount',
        'calculate'
    ];

    /**
     * The attributes that should be casted to native types.
     *
     * @var array
     */
    protected $casts = [
        'user_id' => 'integer',
        'type' => 'integer',
        'add_type' => 'integer',
        'junior_id' => 'integer',
        'title' => 'string',
        'amount' => 'integer',
        'calculate' => 'integer'
    ];

    /**
     * Validation rules
     *
     * @var array
     */
    public static $rules = [
        
    ];

    public function user()
    {
        return $this->belongsTo('App\User');
    }
    public function junior()
    {
        return $this->belongsTo('App\User','junior_id');
    }
}
